import Taro, { Component, useState } from '@tarojs/taro';
import { View, Image } from '@tarojs/components';
import Kind from '../../static/card/icon_kind.png';
import NumberIcon from '../../static/card/icon_number.png';
import Time from '../../static/card/icon_time.png';
import Agengcy from '../../static/card/icon_people.png';
import Close from '../../static/card/icon_delete.png';

import classnames from 'classnames';

import './index.scss';

/**
 * @param {number} type 0 是我的兑换卡记录 1 是申领卡 2申领记录(申请卡和激活卡的区别是第二行一个是数量一个卡号) 3 我的兑换卡 4 出库卡的信息 5 入库记录 6 出库记录
 * @param {viplist} type 0 是我的兑换卡记录 1 是申领卡 2申领记录(申请卡和激活卡的区别是第二行一个是数量一个卡号) 3 我的兑换卡 4 出库卡的信息 5 入库记录 6 出库记录

 */
function Card({ viplist, sku, status, number, type = 0, cardType, agency, cardId }) {
  const uerInfo = Taro.getStorageSync('userInfo');
  var isAgreement = false
  function deleteOutput() {
    this.props['onDel'](number)
  }

  function sureArrive() {
    this.props['arrive'](cardId)
  }
  function showcard(viplist) {
    Taro.navigateTo({
      url: `/subPacKagebWork/pages/vip-record-all/index?viplist=${JSON.stringify(viplist)}`
    })  }

  return (
    <View className={classnames({
      "card": true,
      "not-my": type,
    })} onClick={() => showcard(viplist)}>
      <View className="card-line">
        <Image src={Time} alt="" className="icon" />
        <View>卡号：{viplist.card_no}</View>
      </View>
      <View className="card-line">
        <Image src={Time} alt="" className="icon" />
        <View>会员类型：{viplist.member_type}</View>
      </View>
      {/* <View className="card-line">
        <Image src={Time} alt="" className="icon" />
        <View>状态：{viplist.status}</View>
      </View> */}
      {uerInfo.level == 1 && viplist.level_two_user_id > 0 ? (
        <View className="card-line">
          <Image src={Time} alt="" className="icon" />
          <View>区代用户名：{viplist.has_level_two_user.nickname}</View>
        </View>) : (
          ''
        )}
      {viplist.user_id > 0 ? (
        <View className="card-line">
          <Image src={Time} alt="" className="icon" />
          <View>会员用户名：{viplist.has_user.nickname}</View>
        </View>) : (
          ''
        )}
      {/* <View className="card-line">
        <Image src={Time} alt="" className="icon" />
        <View>更新时间时间：{viplist.update_time}</View>
      </View> */}
  
      {/* {
 
      }
      <View className="card-line" >
        <Image src={Kind} alt="" className="icon" />
        {(!type) && <View>兑换规格：{sku}</View>}
        {(type) && <View>类型：{cardType}</View>}
      </View>
      {
        (type === 6) && <View className="card-line" >
          <Image src={Agengcy} alt="" className="icon" />
          <View>代理：{agency}</View>
        </View>
      } */}
    </View>

  )
}

export default Card;
